package main

import (
	"fmt"
	"io/ioutil"
	"net/http"
	"time"
)

func main() {


	client := http.Client{CheckRedirect: func(req *http.Request, via []*http.Request) error {

		return nil
	}}

	//response, _ := client.Do(request)

	request, e := http.NewRequest(http.MethodGet, "http://bs.jwell56.com/led/api/v1/yunwang/LargeScreenGetJwellYunWeightEveryDayData?pageSize=180&isSameDay=0",nil)

	if e != nil {

		fmt.Println("e ::: ", e)

	}

	request.Header.Add("Referer", "http://localhost:8400/swagger-ui.html")
	request.Header.Set("User-Agent", "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/70.0.3538.67 Safari/537.36")

	for i := 0; i < 100; i++ {

		go func() {

			for j := 0; j < 1000; j++ {



				response,e := client.Do(request)

				fmt.Println(e)

				if response != nil {
					bytes, _ := ioutil.ReadAll(response.Body)

					fmt.Println(string(bytes))
				}

			}

		}()

	}



	time.Sleep(time.Minute * 10)

	/*cookies := response.Cookies()

	for _, v := range cookies {

		fmt.Printf("name : %s , value: %s \n", v.Name, v.Value)
	}
*/
}
